<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/jquery-easyui-1.3.3/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/jquery-easyui-1.3.3/themes/icon.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery-easyui-1.3.3/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">

	
function addposition(){
	$("#fm").form("submit",{
		url:'${pageContext.request.contextPath}/position/addnewaddposition.action',
		onSubmit:function(){
			var position2=$("#position2").val();
			if(position2==""){
				$.messager.alert("系统提示","请填好新增的职位名称！");
				return false;
			}
			
			var sd=$("#sd").combobox("getValue");
			/* if($('#position1').combobox('getValue')==""){
				return true;
			} */
			if($('#position1').combobox('getValue')==""&&sd!=""){
				return false;
			}
			if(sd==""){
				$.messager.alert("系统提示","请选择好职位对应的薪酬标准！");
				return false;
			}
			return true;
		},
		success:function(result){
			var result=eval('('+result+')');
			if(result.success){
				$.messager.alert("系统提示","职位新增成功！");
				$('#position1').combobox('reload');      // 使用旧的URL重新载入列表数据

				$("#position2").val("");
				$("#position1").val("");
			}else{
				$.messager.alert("系统提示","职位新增失败");
				return;
			}
		}
	});
}

</script>
</head>
<body>

	<form id="fm" method="post">
		<table >
	 			<tr>
	 				<td>请选择该新增职位所属的职位类型：</td>
	 				<td><input class="easyui-combobox" name="position1" id="position1"
									data-options="
									url:'${pageContext.request.contextPath}/position/getall.action',
									valueField:'id',
									textField:'text',
									panelHeight:'auto'">
					</td>
					<td>请填写要新增的职位：</td>
					<td><input type="text" name="position2" id="position2"></td>
					<td><a href="javascript:addposition()" class="easyui-linkbutton" iconCls="icon-ok">添加关系</a></td>
				</tr>
				<tr>
					<td>请选择该新增职位对应的薪酬标准：</td>
	 				<td><input class="easyui-combobox" name="sd" id="sd"
									data-options="
									url:'${pageContext.request.contextPath}/salarystandard/getsalarystandard.action',
									valueField:'text',
									textField:'text',
									panelHeight:'auto'">
					</td>
				</tr>
		</table>
	</form>
</body>
</html>